package cn.wolfcode.wolf2w.job.task;

import cn.wolfcode.wolf2w.common.core.constant.SecurityConstants;
import cn.wolfcode.wolf2w.strategy.api.RemoteStrategyRankService;
import cn.wolfcode.wolf2w.strategy.api.domain.StrategyRank;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("strategyRankTask")
public class StrategyRankTask {

    @Autowired
    private RemoteStrategyRankService remoteStrategyRankService;

    public void strategyRankHandle()
    {
        System.out.println("--------------------攻略排行数据维护-begin-----------------------");

        //攻略排行数据在strategy微服务， 而当前定时任务操作在job微服务，存在跨服调用--远程调用逻辑
        //1: 使用慢sql 从大表(strategy) 查询数据
        //2：将返回值添加小表(strategy_rank)中
        remoteStrategyRankService.strategyRankHandle(StrategyRank.TYPE_ABROAD, SecurityConstants.INNER);   //国外
        remoteStrategyRankService.strategyRankHandle(StrategyRank.TYPE_CHINA, SecurityConstants.INNER);    //国内
        remoteStrategyRankService.strategyRankHandle(StrategyRank.TYPE_HOT, SecurityConstants.INNER);      //热门

        System.out.println("--------------------攻略排行数据维护-end-----------------------");
    }

}
